package com.zsrt.javaweb.bbu.book.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zsrt.javaweb.bbu.book.service.BookShopService;
import com.zsrt.javaweb.bbu.book.service.Cashier;

@Service("cashier")
public class CashierImpl implements Cashier {

	@Autowired
	private BookShopService bookShopService;
	
	
	/**
	 * 一个事务方法调用另外一个事务方法
	 */
	@Transactional
	@Override
	public void checkout(String username, List<Integer> isbns) {
		
		for(Integer isbn: isbns){
			bookShopService.purchase(username, isbn);
		}

	}

}
